<template>
        <form>
          <el-input
            class="inputChange"
            v-model="userPassword_origin"
            placeholder="请输入旧密码"
          />
          <el-input
            class="inputChange"
            v-model="userPassword_new1"
            placeholder="请输入新密码"
          />
          <el-input
            class="inputChange"
            v-model="userPassword_new2"
            placeholder="请再次输入新密码"
          />
          <el-button
            class="firstButton"
            type="primary"
            @click="userPasswordChange"
            >提交</el-button
          >
          <el-button @click="passwordEmpty">清空</el-button>
        </form>
</template>

<script>
import axios from 'axios';
export default {  
    name:"PasswordChangeForm",
    data(){
      return{
        userPassword_origin:"",
        userPassword_new1:"",
        userPassword_new2:"",
      }
    },
    methods: {
      userPasswordChange: function () {
      // console.log(this.$store.state.token);
      var that = this;
      axios.post("WebApps/passwordModification",
        {
        userPassword_origin:this.userPassword_origin,
        newPassword_new1:this.userPassword_new1,
        newPassword_new2:this.userPassword_new2,
        token:this.$store.state.token,
        }
      ).then(
        function (resp) {
          if(resp.data.code == 200){
            that.$message.success("修改成功");
          }else{
            that.$message.error("修改失败");
          }
        },
        function (err) {
          console.log(err);
        }
      );
    },
    passwordEmpty: function () {
      this.passwordChange.old = "";
      this.passwordChange.new1 = "";
      this.passwordChange.new2 = "";
    },
    },
    
}
</script>

<style>

</style>